<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="modify.Alter"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
<%
            request.setCharacterEncoding("utf-8");
	        String qq = request.getParameter("qq");
//			out.print("<script>"+
//					   "var regex=new RegExp('^\\d{8,10}$');"+
//					   "alert('just test');if(!regex.test("+qq+"))"+
//					   "{alert('QQ的格式不符合规范！');return false;}else{alert('QQ修改成功！');}"+
//					   "</script>");
	        String mail = request.getParameter("mail");
//			out.print("<script>"+
//			           "var regex=new RegExp('^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$');"+
//					   "if(!regex.test("+mail+"))"+
//					   "{alert('电子邮件的格式不符合规范！');return false;}else{alert('电邮修改成功！');}"+
//					   "</script>");
	        String local = request.getParameter("local");
	        String sex = request.getParameter("sex");
	        String birth = request.getParameter("birth");
	        java.sql.Date bir = new java.sql.Date(Integer.parseInt(birth.split("/")[2])-1900,
			                                      Integer.parseInt(birth.split("/")[0])-1,
												  Integer.parseInt(birth.split("/")[1]));	   
	        String tel = request.getParameter("tel");
//			out.print("<script>"+
//			           "var regex=new RegExp('^\\d{11}$');"+
//					   "if(!regex.test("+tel+"))"+
//					   "{alert('电话号码必须是十一位数字！');return false;window.location='base.jsp';}else{alert('电话修改成功！');}"+
//					   "</script>");
	        String pa = request.getParameter("pa");
	        String ma = request.getParameter("ma");
	        String food = request.getParameter("food");
	        String pri = request.getParameter("pri");
	        String mid = request.getParameter("mid");
	        String hig = request.getParameter("hig");
//			String id = ;
//			out.print("<script>alert("+id+");</script>");
			int id = Integer.parseInt(request.getParameter("id"));
			
			Alter main = new Alter(id);
			Alter detl = new Alter(id);
			
			main.changeMai(qq,tel,mail,local,sex,bir);
			detl.changeDet(ma,pa,pri,mid,hig,food);
			out.print("信息修改成功！");
%>
</body>
</html>
